home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / science / sm32a.zip / LIBRARY / DSOLVE.LI < prev    next >
Text File  |  1993-11-15  |  632b  |  16 lines

  1. #    differential eq solver
  2. #    the ordinary differential equation lib 
  3. #    e.g. dsolve( y'(x) = x*y(x), y(x),x)
  4.  
  5. dsolve(f_,y_,x_) := subs(dsolver(subs(right(f), y=yy), yy,x),    yy=y)
  6.  
  7. dsolver(f1_,y_,x_) := if(isfree(f1,y), y=inte(f1,x)+constant)
  8. dsolver(f2_,y_,x_) := if(isfree(f2,x), inte(1/f2, y)=x+constant)
  9. dsolver(f3_,y_,x_) := if(f3-coef(f3,y)*y==0,
  10.     y=constant*e^inte(coef(f3,y),x) )
  11. dsolver(f4_,y_,x_) := if(f4-coef(f4,x)*x==0,
  12.     inte(1/coef(f4,x),y)=constant+x^2/2 )
  13. dsolver(f5_,y_,x_) := if(isfree(f5-coef(f5,y)*y, y),
  14.     block(dsolve:=inte(coef(f5,y),x),
  15.     y=e^dsolve*(inte((f5-coef(f5,y)*y)*e^-dsolve,x)+constant)))
  16.